import React, { useEffect, useState } from 'react';
import TitleBack from '../../components/TitleBack/TitleBack';
import { reqgetbanner } from '../../http/api';
import { Carousel } from 'antd-mobile';
import "./Mine.less"

export default function Mine() {
    const [banner, setbanner] = useState([])
    useEffect(() => {
        reqgetbanner().then(res => {
            if (res.data.code === 200) {
                setbanner(res.data.list ? res.data.list : [])
            }
        })
    }, [])
    console.log(banner);
    return (
        <div className="mine">
            <TitleBack title={"购物车"}></TitleBack>
            <Carousel
                className="banner"
                autoplay={true}
                infinite
            >
                {banner.map(item => (

                    <img
                        src={item.img}
                        alt=""
                        style={{ width: '100%', verticalAlign: 'top' }}
                        key={item.id}
                    />
                ))}
            </Carousel>
        </div>
    )
}
